/**
 * 
 */
package com.klarna.raas.datamodel.impl;

import java.math.BigInteger;

import org.apache.commons.lang.builder.ToStringBuilder;

import com.klarna.raas.datamodel.ifs.IRequest;

/**
 * @author aviad.tamir
 *
 */
public class RequestImpl implements IRequest {

	private BigInteger id;
	private BigInteger customerId;
	private String firstName;
	private String lastName;
	private String street;
	private String city;
	private String zip;
	private String careOf;
	private String country;
	private String email;
	private String birthDate;
	private String clientIP;
	private BigInteger purchaseAmount;
	private int estoreId;
	
	public RequestImpl(String body) {
		if (body!=null && !body.isEmpty()) {
			String[] params = body.split(",");
			this.id = new BigInteger(params[0]);
			this.customerId = new BigInteger(params[1]);
			this.firstName = params[2];
			this.lastName = params[3];
			this.street = params[4];
			this.city = params[5];
			this.zip = params[6];
			this.careOf = params[7];
			this.country = params[8];
			this.email = params[9];
			this.birthDate = params[10];
			this.clientIP = params[11];
			this.purchaseAmount = new BigInteger(params[12]);
			this.estoreId = Integer.parseInt(params[13]);
		} else {
			throw new IllegalArgumentException("body=" + body);
		}
	}
	public BigInteger getId() {
		return id;
	}
	public void setId(BigInteger id) {
		this.id = id;
	}
	public BigInteger getCustomerId() {
		return customerId;
	}
	public void setCustomerId(BigInteger customerId) {
		this.customerId = customerId;
	}
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getStreet() {
		return street;
	}
	public void setStreet(String street) {
		this.street = street;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getZip() {
		return zip;
	}
	public void setZip(String zip) {
		this.zip = zip;
	}
	public String getCareOf() {
		return careOf;
	}
	public void setCareOf(String careOf) {
		this.careOf = careOf;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getBirthDate() {
		return birthDate;
	}
	public void setBirthDate(String birtDate) {
		this.birthDate = birtDate;
	}
	public String getClientIP() {
		return clientIP;
	}
	public void setClientIP(String clientIP) {
		this.clientIP = clientIP;
	}
	public BigInteger getPurchaseAmount() {
		return purchaseAmount;
	}
	public void setPurchaseAmount(BigInteger purchaseAmount) {
		this.purchaseAmount = purchaseAmount;
	}
	public int getEstoreId() {
		return estoreId;
	}
	public void setEstoreId(int estoreId) {
		this.estoreId = estoreId;
	}
	
	 public String toString() {
		 return new ToStringBuilder(this).
			       append("id", id.toString()).
			       append("customerId", customerId.toString()).
			       append("firstName", firstName).
			       append("lastName", lastName).
			       append("street", street).
			       append("city", city).
			       append("zip", zip).
			       append("careOf", careOf).
			       append("country", country).
			       append("birthDate", birthDate).
			       append("clientIP", clientIP).
			       append("purchaseAmount", purchaseAmount.toString()).
			       append("estoreId", estoreId).
	       toString();
	   }
}
